let myQuestionsApp = new Vue({
    el:'#myQuestionsApp',
    data:{
        questions:[
            {

                statusText:'未解决',
                statusClass:'badge-warning',
                title:'这是第一个问题',
                content:'问题的正文',
                tags:[{id:1,name:'Java基础'},{id:2,name:'JavaOOP'}],
                userNickName:'张三 ',
                hits:916,
                gmtCreateText:'12分钟前',
            },
            {
                statusText:'未回复',
                statusClass:'badge-warning',
                title:'这是第一个问题',
                content:'问题的正文',
                tags:[{id:1,name:'Java基础'},{id:2,name:'JavaOOP'}],
                userNickName:'张三 ',
                hits:916,
                gmtCreateText:'12小时前',
            },
            {
                statusText:'已解决',
                statusClass:'badge-success',
                title:'这是第一个问题',
                content:'问题的正文',
                tags:[{id:1,name:'Java基础'},{id:2,name:'JavaOOP'}],
                userNickName:'张三 ',
                hits:916,
                gmtCreateText:'2天前',
            }
        ],
        prePage:0,
        nextPage:0,
        navigatepageNums:[],
        currentPageNum:0
    },
    methods:{
        loadMyQuestions:function (page) {
            if (page<1) {
                return;
            }
            $.ajax({
                url:'/portal/questions/my',
                data:'page='+page,
                success:function (r) {
                    let list = r.data.list;
                    let statusTexts=['未回复','已回复','已解决'];
                    let statusClass=['badge-warning','badge-info','badge-success'];
                    for (let i = 0; i < list.length; i++) {
                        list[i].statusText=statusTexts[list[i].status];
                        list[i].statusClass=statusClass[list[i].status];
                        list[i].gmtCreateText=getTimeText(list[i].gmtCreate);

                    }

                    myQuestionsApp.questions =list;
                    myQuestionsApp.prePage = r.data.prePage;
                    myQuestionsApp.nextPage = r.data.nextPage;
                    myQuestionsApp.navigatepageNums = r.data.navigatepageNums;
                    myQuestionsApp.currentpageNum = r.data.pageNum;

                }
            });
        }
    },
    created:function () {
        this.loadMyQuestions(1);
    }


})